
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>六、索引 · 计算机笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="海拉尔的三角">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro-fixed/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-ancre-navigation/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-code/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-insert-logo-link-website/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism-tomorrow.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-pageview-count/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-katex-pro/katex.min.css">
                
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-terminull-light/terminull.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="authority_withNum.html" />
    
    
    <link rel="prev" href="transaction_withNum.html" />
    

    
        <link rel="shortcut icon" href="image/ico.png" type="image/x-icon">
    
    
    
    
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="image/ico.png">
    
    
        
    
    
        
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="https://github.com/spite-triangle" target="_blank" class="custom-link">Github</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    简介
            
                </a>
            

            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../../cpp/cpp.html">
            
                <a href="../../cpp/cpp.html">
            
                    
                    C/C++
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1.1" data-path="../../cpp/chapter/foundation_withNum.html">
            
                <a href="../../cpp/chapter/foundation_withNum.html">
            
                    
                    一、基础概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.2" data-path="../../cpp/chapter/keyword_withNum.html">
            
                <a href="../../cpp/chapter/keyword_withNum.html">
            
                    
                    二、关键字
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.3" data-path="../../cpp/chapter/point_reference_withNum.html">
            
                <a href="../../cpp/chapter/point_reference_withNum.html">
            
                    
                    三、指针与引用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.4" data-path="../../cpp/chapter/oop_withNum.html">
            
                <a href="../../cpp/chapter/oop_withNum.html">
            
                    
                    四、面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.5" data-path="../../cpp/chapter/memory_withNum.html">
            
                <a href="../../cpp/chapter/memory_withNum.html">
            
                    
                    五、内存
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.6" data-path="../../cpp/chapter/process_withNum.html">
            
                <a href="../../cpp/chapter/process_withNum.html">
            
                    
                    六、进程与线程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.7" data-path="../../cpp/chapter/locks_withNum.html">
            
                <a href="../../cpp/chapter/locks_withNum.html">
            
                    
                    七、锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.8" data-path="../../cpp/chapter/stl_withNum.html">
            
                <a href="../../cpp/chapter/stl_withNum.html">
            
                    
                    八、STL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.9" data-path="../../cpp/chapter/dataStruction_withNum.html">
            
                <a href="../../cpp/chapter/dataStruction_withNum.html">
            
                    
                    九、数据结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.10" data-path="../../cpp/chapter/array_list_withNum.html">
            
                <a href="../../cpp/chapter/array_list_withNum.html">
            
                    
                    十、数组链表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.11" data-path="../../cpp/chapter/find_withNum.html">
            
                <a href="../../cpp/chapter/find_withNum.html">
            
                    
                    十一、目标查找
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.12" data-path="../../cpp/chapter/tree_withNum.html">
            
                <a href="../../cpp/chapter/tree_withNum.html">
            
                    
                    十二、树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.13" data-path="../../cpp/chapter/binaryTree_withNum.html">
            
                <a href="../../cpp/chapter/binaryTree_withNum.html">
            
                    
                    十三、二叉树
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.14" data-path="../../cpp/chapter/dynamicProgram_withNum.html">
            
                <a href="../../cpp/chapter/dynamicProgram_withNum.html">
            
                    
                    十四、动态规划
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.15" data-path="../../cpp/chapter/backtracking_withNum.html">
            
                <a href="../../cpp/chapter/backtracking_withNum.html">
            
                    
                    十五、回溯算法
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.16" data-path="../../cpp/chapter/monotoneStack_withNum.html">
            
                <a href="../../cpp/chapter/monotoneStack_withNum.html">
            
                    
                    十六、单调栈
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.1.17" data-path="../../cpp/chapter/toollib_withNum.html">
            
                <a href="../../cpp/chapter/toollib_withNum.html">
            
                    
                    附录 工具库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="../mysql.html">
            
                <a href="../mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1.1" data-path="introduction_withNum.html">
            
                <a href="introduction_withNum.html">
            
                    
                    一、简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.2" data-path="foundation_withNum.html">
            
                <a href="foundation_withNum.html">
            
                    
                    二、控制台操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.3" data-path="operatorDB_withNum.html">
            
                <a href="operatorDB_withNum.html">
            
                    
                    三、数据库、表操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.4" data-path="operatorData_withNum.html">
            
                <a href="operatorData_withNum.html">
            
                    
                    四、数据操作
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.5" data-path="transaction_withNum.html">
            
                <a href="transaction_withNum.html">
            
                    
                    五、事务
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="3.1.6" data-path="index_withNum.html">
            
                <a href="index_withNum.html">
            
                    
                    六、索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.7" data-path="authority_withNum.html">
            
                <a href="authority_withNum.html">
            
                    
                    七、权限管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.1.8" data-path="backup_withNum.html">
            
                <a href="backup_withNum.html">
            
                    
                    八、备份
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../../linux/linux.html">
            
                <a href="../../linux/linux.html">
            
                    
                    Linux
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1.1" data-path="../../linux/chapter/foundation_withNum.html">
            
                <a href="../../linux/chapter/foundation_withNum.html">
            
                    
                    一、原理知识
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.1.2" data-path="../../linux/chapter/command_withNum.html">
            
                <a href="../../linux/chapter/command_withNum.html">
            
                    
                    二、指令
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="divider"></li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../../tcp_udp/tcp_upd.html">
            
                <a href="../../tcp_udp/tcp_upd.html">
            
                    
                    网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.1.1" data-path="../../tcp_udp/chapter/foundation_withNum.html">
            
                <a href="../../tcp_udp/chapter/foundation_withNum.html">
            
                    
                    一、网络通讯基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.1.2" data-path="../../tcp_udp/chapter/tcp_udp_withNum.html">
            
                <a href="../../tcp_udp/chapter/tcp_udp_withNum.html">
            
                    
                    二、tcp/udp
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >六、索引</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-anchor"></i><ul><li><span class="title-icon "></span><a href="#&#x7D22;&#x5F15;"><b></b>&#x7D22;&#x5F15;</a></li><li><span class="title-icon "></span><a href="#1-&#x7D22;&#x5F15;&#x7B80;&#x4ECB;"><b></b>1. &#x7D22;&#x5F15;&#x7B80;&#x4ECB;</a></li><li><span class="title-icon "></span><a href="#2-&#x7D22;&#x5F15;&#x5206;&#x7C7B;"><b></b>2. &#x7D22;&#x5F15;&#x5206;&#x7C7B;</a></li><li><span class="title-icon "></span><a href="#3-&#x7D22;&#x5F15;&#x6307;&#x4EE4;"><b></b>3. &#x7D22;&#x5F15;&#x6307;&#x4EE4;</a></li><ul><li><span class="title-icon "></span><a href="#31-&#x663E;&#x793A;&#x8868;&#x4E2D;&#x6240;&#x6709;&#x7684;&#x7D22;&#x5F15;"><b></b>3.1. &#x663E;&#x793A;&#x8868;&#x4E2D;&#x6240;&#x6709;&#x7684;&#x7D22;&#x5F15;</a></li><li><span class="title-icon "></span><a href="#32-&#x7D22;&#x5F15;&#x7684;&#x521B;&#x5EFA;"><b></b>3.2. &#x7D22;&#x5F15;&#x7684;&#x521B;&#x5EFA;</a></li><ul><li><span class="title-icon "></span><a href="#321-&#x521B;&#x5EFA;&#x8868;&#x65F6;"><b></b>3.2.1. &#x521B;&#x5EFA;&#x8868;&#x65F6;</a></li><li><span class="title-icon "></span><a href="#322-&#x6DFB;&#x52A0;&#x8868;&#x7EA7;&#x522B;&#x7D22;&#x5F15;&#x7EA6;&#x675F;"><b></b>3.2.2. &#x6DFB;&#x52A0;&#x8868;&#x7EA7;&#x522B;&#x7D22;&#x5F15;&#x7EA6;&#x675F;</a></li></ul><li><span class="title-icon "></span><a href="#33-&#x5206;&#x6790;explain"><b></b>3.3. &#x5206;&#x6790;explain</a></li></ul><li><span class="title-icon "></span><a href="#4-&#x7EC4;&#x5408;&#x7D22;&#x5F15;"><b></b>4. &#x7EC4;&#x5408;&#x7D22;&#x5F15;</a></li><li><span class="title-icon "></span><a href="#5-&#x7D22;&#x5F15;&#x539F;&#x5219;"><b></b>5. &#x7D22;&#x5F15;&#x539F;&#x5219;</a></li></ul></div><a href="#&#x7D22;&#x5F15;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 style="font-size:60px;text-align:center;" id="&#x7D22;&#x5F15;"><a name="&#x7D22;&#x5F15;" class="anchor-navigation-ex-anchor" href="#&#x7D22;&#x5F15;"><i class="fa fa-link" aria-hidden="true"></i></a>&#x7D22;&#x5F15;</h1>

<h1 id="1-&#x7D22;&#x5F15;&#x7B80;&#x4ECB;"><a name="1-&#x7D22;&#x5F15;&#x7B80;&#x4ECB;" class="anchor-navigation-ex-anchor" href="#1-&#x7D22;&#x5F15;&#x7B80;&#x4ECB;"><i class="fa fa-link" aria-hidden="true"></i></a>1. &#x7D22;&#x5F15;&#x7B80;&#x4ECB;</h1>
<blockquote>
<p>[!note]
<strong>&#x4F5C;&#x7528;&#xFF1A;&#x5FEB;&#x901F;&#x63D0;&#x5347;<code>MySQL</code>&#x83B7;&#x53D6;&#x6570;&#x636E;&#x7684;&#x901F;&#x5EA6;&#x3002;</strong>
<strong>&#x6548;&#x679C;&#xFF1A;&#x5C0F;&#x6570;&#x636E;&#x7684;&#x65F6;&#x5019;&#x7528;&#x5904;&#x4E0D;&#x5927;&#xFF0C;&#x5927;&#x6570;&#x636E;&#x65F6;&#x6548;&#x679C;&#x5341;&#x5206;&#x660E;&#x663E;&#x3002;</strong>
<strong>&#x7F3A;&#x70B9;&#xFF1A;&#x8868;&#x884C;&#x6570;&#x636E;&#x7684;&#x53D8;&#x5316;&#xFF08;insert, update, delete&#xFF09;&#xFF0C;&#x5EFA;&#x7ACB;&#x5728;&#x8868;&#x5217;&#x4E0A;&#x7684;&#x7D22;&#x5F15;&#x4E5F;&#x4F1A;&#x81EA;&#x52A8;&#x7EF4;&#x62A4;&#xFF0C;&#x4E00;&#x5B9A;&#x7A0B;&#x5EA6;&#x4E0A;&#x4F1A;&#x4F7F;<code>DML</code>&#x64CD;&#x4F5C;&#x53D8;&#x6162;&#xFF1B;&#x7D22;&#x5F15;&#x4F1A;&#x5360;&#x7528;&#x78C1;&#x76D8;&#x989D;&#x5916;&#x7684;&#x5B58;&#x50A8;&#x7A7A;&#x95F4;&#x3002;</strong></p>
</blockquote>
<h1 id="2-&#x7D22;&#x5F15;&#x5206;&#x7C7B;"><a name="2-&#x7D22;&#x5F15;&#x5206;&#x7C7B;" class="anchor-navigation-ex-anchor" href="#2-&#x7D22;&#x5F15;&#x5206;&#x7C7B;"><i class="fa fa-link" aria-hidden="true"></i></a>2. &#x7D22;&#x5F15;&#x5206;&#x7C7B;</h1>
<blockquote>
<p>[!tip]</p>
<ul>
<li><code>primary key()</code>&#xFF1A;&#x4E3B;&#x952E;&#x7D22;&#x5F15;<ul>
<li>&#x552F;&#x4E00;&#x6807;&#x8BC6;&#xFF0C;&#x4E3B;&#x952E;&#x4E0D;&#x53EF;&#x91CD;&#x590D;</li>
<li>&#x4E00;&#x5F20;&#x8868;&#x6700;&#x591A;&#x53EA;&#x80FD;&#x6709;&#x4E00;&#x4E2A;&#x4E3B;&#x952E;</li>
</ul>
</li>
<li><code>unique key()</code>&#xFF1A;&#x552F;&#x4E00;&#x7D22;&#x5F15;<ul>
<li>&#x540C;&#x4E00;&#x5B57;&#x6BB5;&#x7684;&#x6570;&#x636E;&#x4E0D;&#x8BFE;&#x91CD;&#x590D;</li>
<li>&#x4E00;&#x5F20;&#x8868;&#x53EF;&#x4EE5;&#x53EF;&#x4EE5;&#x8868;&#x793A;&#x591A;&#x4E2A;&#x5B57;&#x6BB5;</li>
</ul>
</li>
<li><code>key/index</code>&#xFF1A;&#x5E38;&#x89C4;&#x7D22;&#x5F15;<ul>
<li>&#x9ED8;&#x8BA4;&#x7684;&#x5E38;&#x89C4;&#x7D22;&#x5F15;</li>
</ul>
</li>
<li><code>fullText</code>&#xFF1A;&#x5168;&#x6587;&#x7D22;&#x5F15;<ul>
<li>&#x53EA;&#x6709;&#x7279;&#x5B9A;&#x6570;&#x636E;&#x5E93;&#x7C7B;&#x578B;&#x652F;&#x6301;(<code>MYISAM</code>)</li>
<li>&#x67E5;&#x627E;&#x7684;&#x662F;&#x6587;&#x672C;&#x4E2D;&#x7684;&#x5173;&#x952E;&#x8BCD;&#xFF0C;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x5168;&#x6587;&#x68C0;&#x7D22;</li>
</ul>
</li>
<li><strong><code>(</code>&#x5B57;&#x6BB5;1<code>,</code>&#x5B57;&#x6BB5;2<code>,..)</code>: &#x7EC4;&#x5408;&#x7D22;&#x5F15;</strong><ul>
<li>&#x5C06;&#x591A;&#x4E2A;&#x5B57;&#x6BB5;&#x7EC4;&#x5408;&#xFF0C;&#x5EFA;&#x7ACB;&#x8D77;&#x4E00;&#x4E2A;&#x7D22;&#x5F15;&#x3002;</li>
</ul>
</li>
</ul>
</blockquote>
<h1 id="3-&#x7D22;&#x5F15;&#x6307;&#x4EE4;"><a name="3-&#x7D22;&#x5F15;&#x6307;&#x4EE4;" class="anchor-navigation-ex-anchor" href="#3-&#x7D22;&#x5F15;&#x6307;&#x4EE4;"><i class="fa fa-link" aria-hidden="true"></i></a>3. &#x7D22;&#x5F15;&#x6307;&#x4EE4;</h1>
<h2 id="31-&#x663E;&#x793A;&#x8868;&#x4E2D;&#x6240;&#x6709;&#x7684;&#x7D22;&#x5F15;"><a name="31-&#x663E;&#x793A;&#x8868;&#x4E2D;&#x6240;&#x6709;&#x7684;&#x7D22;&#x5F15;" class="anchor-navigation-ex-anchor" href="#31-&#x663E;&#x793A;&#x8868;&#x4E2D;&#x6240;&#x6709;&#x7684;&#x7D22;&#x5F15;"><i class="fa fa-link" aria-hidden="true"></i></a>3.1. &#x663E;&#x793A;&#x8868;&#x4E2D;&#x6240;&#x6709;&#x7684;&#x7D22;&#x5F15;</h2>
<pre class="language-"><code class="lang-sql"><span class="token keyword">show</span> <span class="token keyword">index</span> <span class="token keyword">from</span> <span class="token punctuation">`</span>&#x8868;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="32-&#x7D22;&#x5F15;&#x7684;&#x521B;&#x5EFA;"><a name="32-&#x7D22;&#x5F15;&#x7684;&#x521B;&#x5EFA;" class="anchor-navigation-ex-anchor" href="#32-&#x7D22;&#x5F15;&#x7684;&#x521B;&#x5EFA;"><i class="fa fa-link" aria-hidden="true"></i></a>3.2. &#x7D22;&#x5F15;&#x7684;&#x521B;&#x5EFA;</h2>
<h3 id="321-&#x521B;&#x5EFA;&#x8868;&#x65F6;"><a name="321-&#x521B;&#x5EFA;&#x8868;&#x65F6;" class="anchor-navigation-ex-anchor" href="#321-&#x521B;&#x5EFA;&#x8868;&#x65F6;"><i class="fa fa-link" aria-hidden="true"></i></a>3.2.1. &#x521B;&#x5EFA;&#x8868;&#x65F6;</h3>
<pre class="language-"><code class="lang-sql"><span class="token keyword">create</span> <span class="token keyword">table</span> <span class="token punctuation">`</span>&#x8868;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">(</span>
    &#x5B57;&#x6BB5;&#x3002;&#x3002;&#x3002;
    <span class="token keyword">primary</span> <span class="token keyword">key</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token keyword">unique</span> <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    fullText <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token keyword">engine</span><span class="token operator">=</span><span class="token keyword">INNODB</span> <span class="token keyword">charset</span><span class="token operator">=</span>utf8<span class="token punctuation">;</span>
</code></pre>
<h3 id="322-&#x6DFB;&#x52A0;&#x8868;&#x7EA7;&#x522B;&#x7D22;&#x5F15;&#x7EA6;&#x675F;"><a name="322-&#x6DFB;&#x52A0;&#x8868;&#x7EA7;&#x522B;&#x7D22;&#x5F15;&#x7EA6;&#x675F;" class="anchor-navigation-ex-anchor" href="#322-&#x6DFB;&#x52A0;&#x8868;&#x7EA7;&#x522B;&#x7D22;&#x5F15;&#x7EA6;&#x675F;"><i class="fa fa-link" aria-hidden="true"></i></a>3.2.2. &#x6DFB;&#x52A0;&#x8868;&#x7EA7;&#x522B;&#x7D22;&#x5F15;&#x7EA6;&#x675F;</h3>
<pre class="language-"><code class="lang-sql"><span class="token keyword">alter</span> <span class="token keyword">table</span> <span class="token punctuation">`</span>&#x8868;&#x540D;<span class="token punctuation">`</span> <span class="token keyword">add</span> <span class="token keyword">unique</span> <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">alter</span> <span class="token keyword">table</span> <span class="token punctuation">`</span>&#x8868;&#x540D;<span class="token punctuation">`</span> <span class="token keyword">add</span> <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">alter</span> <span class="token keyword">table</span> <span class="token punctuation">`</span>&#x8868;&#x540D;<span class="token punctuation">`</span> <span class="token keyword">add</span> fulltext <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<pre class="language-"><code class="lang-sql"><span class="token keyword">create</span> &#x7C7B;&#x578B; <span class="token keyword">index</span> &#x7D22;&#x5F15;&#x540D; <span class="token keyword">on</span> <span class="token punctuation">`</span>&#x8868;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">(</span><span class="token punctuation">`</span>&#x5B57;&#x6BB5;<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre>
<h2 id="33-&#x5206;&#x6790;explain"><a name="33-&#x5206;&#x6790;explain" class="anchor-navigation-ex-anchor" href="#33-&#x5206;&#x6790;explain"><i class="fa fa-link" aria-hidden="true"></i></a>3.3. &#x5206;&#x6790;<code>explain</code></h2>
<p><strong>&#x4F5C;&#x7528;&#xFF1A;&#x5206;&#x6790;<code>select</code>&#x67E5;&#x8BE2;&#x8BED;&#x53E5;&#x4F7F;&#x7528;&#x60C5;&#x51B5;&#x3002;</strong></p>
<pre class="language-"><code class="lang-sql"><span class="token keyword">explain</span> <span class="token keyword">select</span> &#x67E5;&#x8BE2;&#x8BED;&#x53E5;<span class="token punctuation">;</span>
</code></pre>
<h1 id="4-&#x7EC4;&#x5408;&#x7D22;&#x5F15;"><a name="4-&#x7EC4;&#x5408;&#x7D22;&#x5F15;" class="anchor-navigation-ex-anchor" href="#4-&#x7EC4;&#x5408;&#x7D22;&#x5F15;"><i class="fa fa-link" aria-hidden="true"></i></a>4. &#x7EC4;&#x5408;&#x7D22;&#x5F15;</h1>
<pre class="language-"><code class="lang-sql"><span class="token keyword">create</span> <span class="token keyword">table</span> <span class="token punctuation">`</span>student<span class="token punctuation">`</span><span class="token punctuation">(</span>
    <span class="token punctuation">`</span>id<span class="token punctuation">`</span> <span class="token keyword">int</span><span class="token punctuation">(</span><span class="token number">11</span><span class="token punctuation">)</span> <span class="token operator">not</span> <span class="token boolean">null</span>  <span class="token keyword">auto_increment</span><span class="token punctuation">,</span>
    <span class="token punctuation">`</span>name<span class="token punctuation">`</span> <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span> <span class="token operator">not</span> <span class="token boolean">null</span><span class="token punctuation">,</span>
    <span class="token punctuation">`</span>address<span class="token punctuation">`</span> <span class="token keyword">varchar</span><span class="token punctuation">(</span><span class="token number">20</span><span class="token punctuation">)</span> <span class="token operator">not</span> <span class="token boolean">null</span><span class="token punctuation">,</span>
    <span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span>

    <span class="token keyword">primary</span> <span class="token keyword">key</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">,</span><span class="token punctuation">`</span>name<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token keyword">key</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span><span class="token punctuation">(</span><span class="token punctuation">`</span>name<span class="token punctuation">`</span><span class="token punctuation">,</span><span class="token punctuation">`</span>address<span class="token punctuation">`</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
    <span class="token keyword">unique</span> <span class="token punctuation">`</span>&#x7D22;&#x5F15;&#x540D;<span class="token punctuation">`</span> <span class="token punctuation">(</span><span class="token punctuation">`</span>address<span class="token punctuation">`</span><span class="token punctuation">,</span><span class="token punctuation">`</span>id<span class="token punctuation">`</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span><span class="token keyword">engine</span><span class="token operator">=</span><span class="token keyword">INNODB</span> <span class="token keyword">charset</span><span class="token operator">=</span>utf8<span class="token punctuation">;</span>
</code></pre>
<blockquote>
<p>[!note]</p>
<ul>
<li><strong>&#x7D22;&#x5F15;&#x90FD;&#x80FD;&#x4F7F;&#x7528;&#x7EC4;&#x5408;&#x7D22;&#x5F15;&#x3002;</strong></li>
<li><strong>&#x7EC4;&#x5408;&#x7D22;&#x5F15;&#x6700;&#x6709;&#x987A;&#x5E8F;&#x533A;&#x522B;&#x3002;</strong>
  &#x5BF9;&#x4E8E;<code>(id,name,address)</code>&#x7EC4;&#x5408;&#x7D22;&#x5F15;&#xFF0C;&#x53EF;&#x4EE5;&#x7B49;&#x6548;&#x4E8E;&#x300C;&#x6309;&#x7167;&#x4ECE;&#x5DE6;&#x5F80;&#x53F3;&#x5EFA;&#x7ACB;&#x8D77;&#x6765;&#x300D;&#x7684;&#x4EE5;&#x4E0B;&#x4E09;&#x79CD;&#x7D22;&#x5F15;<ul>
<li><code>id</code>&#xFF1A;<code>where id=</code></li>
<li><code>id,name</code>&#xFF1A;<code>where id= AND name=&apos;&apos;</code></li>
<li><code>id,name,address</code>&#xFF1A;<code>where id= AND name=&apos;&apos; AND address=&apos;&apos;</code></li>
</ul>
</li>
<li><strong>&#x300C;&#x8054;&#x5408;&#x7D22;&#x5F15;&#x300D;&#x4E0E;&#x300C;&#x5355;&#x5217;&#x7D22;&#x5F15;&#x300D;&#x5217;&#x540C;&#x65F6;&#x5B58;&#x5728;&#xFF0C;&#x4F7F;&#x7528;&#x300C;&#x5355;&#x5217;&#x7D22;&#x5F15;&#x300D;&#x3002;</strong></li>
</ul>
</blockquote>
<h1 id="5-&#x7D22;&#x5F15;&#x539F;&#x5219;"><a name="5-&#x7D22;&#x5F15;&#x539F;&#x5219;" class="anchor-navigation-ex-anchor" href="#5-&#x7D22;&#x5F15;&#x539F;&#x5219;"><i class="fa fa-link" aria-hidden="true"></i></a>5. &#x7D22;&#x5F15;&#x539F;&#x5219;</h1>
<blockquote>
<p>[!note|style:flat]</p>
<ol>
<li><strong>&#x7D22;&#x5F15;&#x4E0D;&#x662F;&#x8D8A;&#x591A;&#x8D8A;&#x597D;</strong></li>
<li><strong>&#x4E0D;&#x9700;&#x8981;&#x5BF9;&#x7ECF;&#x5E38;&#x53D8;&#x52A8;&#x7684;&#x6570;&#x636E;&#x6DFB;&#x52A0;&#x7D22;&#x5F15;</strong></li>
<li><strong>&#x5C0F;&#x6570;&#x636E;&#x4E0D;&#x9700;&#x8981;&#x7D22;&#x5F15;</strong></li>
<li><strong>&#x7D22;&#x5F15;&#x6DFB;&#x52A0;&#x5230;&#x9700;&#x8981;&#x7ECF;&#x5E38;&#x67E5;&#x8BE2;&#x7684;&#x5B57;&#x6BB5;&#x4E0A;</strong></li>
<li><strong>&#x7D22;&#x5F15;&#x4F18;&#x5148;&#x7EA7;&#xFF1A;&#x4E3B;&#x952E;&#x7D22;&#x5F15;&#xFF0C;&#x5355;&#x5217;&#x7D22;&#x5F15;&#xFF0C;&#x7EC4;&#x5408;&#x7D22;&#x5F15;</strong></li>
</ol>
</blockquote>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="transaction_withNum.html" class="navigation navigation-prev " aria-label="Previous page: 五、事务">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="authority_withNum.html" class="navigation navigation-next " aria-label="Next page: 七、权限管理">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"六、索引","level":"3.1.6","depth":2,"next":{"title":"七、权限管理","level":"3.1.7","depth":2,"path":"MySQL/chapter/authority_withNum.md","ref":"MySQL/chapter/authority_withNum.md","articles":[]},"previous":{"title":"五、事务","level":"3.1.5","depth":2,"path":"MySQL/chapter/transaction_withNum.md","ref":"MySQL/chapter/transaction_withNum.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","search-pro-fixed","expandable-chapters-small","ancre-navigation","hide-element","code","splitter","insert-logo-link-website","-sharing","sharing-plus","prism","-highlight","flexible-alerts","lightbox","pageview-count","auto-scroll-table","katex-pro","favicon-absolute","sectionx","terminull-light","livereload"],"styles":{"website":"styles/website.css","ebook":"styles/ebook.css","pdf":"styles/pdf.css","mobi":"styles/mobi.css","epub":"styles/epub.css"},"pluginsConfig":{"prism":{"css":["prismjs/themes/prism-tomorrow.css"],"lang":{"flow":"typescript"}},"livereload":{},"splitter":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"auto-scroll-table":{},"code":{"copyButtons":true},"terminull-light":{},"search-pro-fixed":{},"favicon-absolute":{"favicon":"image/ico.png","appleTouchIconPrecomposed152":"image/ico.png","appleTouchIconMore":{},"appleTouchIconPrecomposedMore":{}},"hide-element":{"elements":[".gitbook-link"]},"katex-pro":{},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{"tag":"b"},"lightbox":{"jquery":true,"sameUuid":false},"insert-logo-link-website":{"url":"image/logo.png","link":"https://space.bilibili.com/27206875","target":"_blank","style":"height: 230px"},"pageview-count":{},"ancre-navigation":{"showLevel":true,"associatedWithSummary":true,"mode":"float","printLog":false,"multipleH1":true,"float":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""},"pageTop":{"showLevelIcon":false,"level1Icon":"","level2Icon":"","level3Icon":""}},"expandable-chapters-small":{},"flexible-alerts":{"style":"callout","note":{"label":"Note","icon":"fa fa-info-circle","className":"info"},"tip":{"label":"Tip","icon":"fa fa-lightbulb-o","className":"tip"},"warning":{"label":"Warning","icon":"fa fa-exclamation-triangle","className":"warning"},"danger":{"label":"Attention","icon":"fa fa-ban","className":"danger"}},"sharing":{"qq":true,"all":["douban","facebook","google","instapaper","linkedin","twitter","weibo","messenger","qq","qzone","viber","whatsapp"],"douban":false,"facebook":false,"weibo":true,"whatsapp":false,"twitter":false,"pocket":false,"google":true,"qzone":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","author":"海拉尔的三角","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"计算机笔记","links":{"sidebar":{"Github":"https://github.com/spite-triangle"}},"gitbook":"*"},"file":{"path":"MySQL/chapter/index_withNum.md","mtime":"2021-09-14T15:43:13.460Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-14T15:43:23.052Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro-fixed/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro-fixed/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-hide-element/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-code/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-insert-logo-link-website/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-pageview-count/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-terminull-light/terminull.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

